﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Backend/Backend.Master" AutoEventWireup="true" CodeBehind="Permission.aspx.cs" Inherits="Phoenix.Backend.Permission" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<!-- Begin one column tab content window -->
    <div class="onecolumn">
	    <div class="header">
            <% System.Data.DataTable dt = Phoenix.AppCode.Bussiness.UsersService.UsersMenuListPermission(Request.QueryString["ID"].ToString(), Request.Cookies["Lang_Backend"].Value); %>
		    <span>Thiết Lập Quyền Quản Lý Cho Tài Khoản: <a href="Users.aspx?Action=Edit&ID=<%=Request.QueryString["ID"].ToString()%>"><%=dt.Rows[0]["UserName"].ToString()%></a></span>
		    <div class="switch" style="margin:7px 15px;">
				<table cellpadding="0" cellspacing="0">
				<tbody>
					<tr>
						<td>
                            <a href="Users.aspx?Action=Create" class="button">Thêm mới tài khoản</a>
						</td>
                        <td>
                            <a href="Users.aspx" class="button">Danh sách</a>
						</td>
					</tr>
				</tbody>
				</table>
			</div>
	    </div>
	    <br class="clear"/>
	    <div class="content">
		    <div id="tab1_content" class="tab_content">
			    <table width="100%">
                    <tr>
                        <td>
                            <div id="tablewrapper">
                                <div id="tableheader">
                                    <div class="search">
                                        <select id="columns" onchange="sorter.search('query')">
                                        </select>
                                        <input type="text" id="query" onkeyup="sorter.search('query')" />
                                    </div>
                                    <div class="details">

                                        <div>
                                            <asp:Label ID="Label20" runat="server" Text='Kết quả' />
                                            <span id="startrecord"></span>-<span id="endrecord"></span>
                                            <asp:Label ID="Label21" runat="server" Text='của' />
                                            <span id="totalrecords"></span>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.reset()">
                                                <asp:Label ID="Label23" runat="server" Text='Thiết lập lại' /></a></div>
                                    </div>
                                </div>
                                <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
                                    <thead>
                                        <tr>
                                            <th class="nosort"><h3>Chọn</h3></th>
                                            <th><h3>Mã DM</h3></th>
                                            <th><h3>Tên danh mục</h3></th>
                                            <th><h3>Đường dẫn</h3></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <%
                                            /* write code get datatable show into for loop */
                                            
                                        for (int i = 0; i < dt.Rows.Count; i++)
                                        {
                                        %>
                                        <tr>
                                            <td style="width:50px;text-align:center;">
                                                <%if (dt.Rows[i]["Visible"].ToString().Equals("True")){ %>
                                                            <a href="Permission.aspx?Action=AddPermission&ID=<%=dt.Rows[i]["ID_Users"].ToString() %>&IDML=<%=dt.Rows[i]["ID_MenuList"].ToString() %>" title="Mở quyền cho tài khoản"><img alt="" src="http://localhost:1109/Content/Backend/js/table/images/checked.png" /></a>
                                            <%}else { %> <a href="Permission.aspx?Action=AddPermission&ID=<%=dt.Rows[i]["ID_Users"].ToString() %>&IDML=<%=dt.Rows[i]["ID_MenuList"].ToString() %>" title="Đóng quyền cho tài khoản"><img alt="" src="http://localhost:1109/Content/Backend/js/table/images/checkout.png" /></a><%} %></td>
                                            <td style="width:60px;text-align:center;"><%=dt.Rows[i]["Location"].ToString()%></td>
                                            <td><%=dt.Rows[i]["MenuName"].ToString()%></td>
                                            <td><%=dt.Rows[i]["URL"].ToString()%></td>
                                        </tr>
                                        <% } %>
                                    </tbody>
                                </table>
                                <div id="tablefooter">
                                    <div id="tablenav">
                                        <div>
                                            <img src="http://localhost:1109/Content/Backend/js/table/images/first.gif" alt=""/>
                                            <img src="http://localhost:1109/Content/Backend/js/table/images/first.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1,true)" />
                                            <img src="http://localhost:1109/Content/Backend/js/table/images/previous.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1)" />
                                            <img src="http://localhost:1109/Content/Backend/js/table/images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
                                            <img src="http://localhost:1109/Content/Backend/js/table/images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
                                        </div>
                                        <div>
                                            <select id="pagedropdown">
                                            </select>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.showall()">
                                                <asp:Label ID="Label25" runat="server" Text='Xem tất cả' /></a>
                                        </div>
                                    </div>
                                    <div id="tablelocation">
                                        <div>
                                            <select onchange="sorter.size(this.value)">
                                                <option value="5">5</option>
                                                <option value="10">10</option>
                                                <option value="20"  selected="selected">20</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
                                            </select>
                                            <span>
                                                <asp:Label ID="Label24" runat="server" Text='Kết quả mỗi trang' /></span>
                                        </div>
                                        <div class="page">
                                            <asp:Label ID="Label55" runat="server" Text='Trang' />
                                            <span id="currentpage"></span>
                                            <asp:Label ID="Label26" runat="server" Text='của' />
                                            <span id="totalpages"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script type="text/javascript" src="http://localhost:1109/Content/Backend/js/table/0.js"></script> <!--vị trí có tham số không sort trên grid đếm từ phải qua trái-->
                            <script type="text/javascript">
                                var sorter = new TINY.table.sorter('sorter', 'table', {
                                    headclass: 'head',
                                    ascclass: 'asc',
                                    descclass: 'desc',
                                    evenclass: 'evenrow',
                                    oddclass: 'oddrow',
                                    evenselclass: 'evenselected',
                                    oddselclass: 'oddselected',
                                    paginate: true,
                                    size: 10,
                                    colddid: 'columns',
                                    currentid: 'currentpage',
                                    totalid: 'totalpages',
                                    startingrecid: 'startrecord',
                                    endingrecid: 'endrecord',
                                    totalrecid: 'totalrecords',
                                    hoverid: 'selectedrow',
                                    pageddid: 'pagedropdown',
                                    navid: 'tablenav',
                                    sortcolumn: 1,
                                    sortdir: 1,
                                    /* sum:[8],
                                    avg:[6,7,8,9],
                                    columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}], */
                                    init: true
                                });
                            </script>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
<!-- End one column tab content window -->
</asp:Content>
